package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

//实验注释
public class TestNote {
    public static void main(String[] args) throws IOException {
        Scanner scanner=new Scanner(System.in);
        FileOutputStream fol=new FileOutputStream("demo.txt");
        System.out.println("请开始写入文本，输入exit结束");
        while (true){
            String content=scanner.next();
            if (content.equals("exit")){
                break;
            }
            fol.write(content.getBytes(StandardCharsets.UTF_8));
            content+="\n";
        }
        System.out.println("写入完毕");
        fol.close();
    }
}
